<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>用户登录</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript">
			$(document).ready(function() {
				var m = decodeURI(getQueryString2("successUrl"))
				if(m != 'null'){	
					$("#successUrl").val(m);
				}
				if("${error}"!=''){
					alertx("${error}");
					$("#username").val("${username}");
					$("#password").val("${password}");
				}
				
				var remember = cookie("rememberit");
				if(remember != null){
					if(remember == 1){
						$("#acheck").removeClass("checkbox_d_uncheck");
						$("#acheck").addClass("checkbox_d");
						if(cookie("username") != null){
							$("#username").val(cookie("username"));
						}						
					}
					else{
						$("#acheck").removeClass("checkbox_d");
						$("#acheck").addClass("checkbox_d_uncheck");
					}
					$("#rememberit").val(remember);
				}
				
				$("#btnLogin").click(function() {
					if($("#username").val()=='' ||$("#username").val()=='请输入手机号'){
						$.jBox.tip('请输入手机号', 'error');
						return false;
					}
					if($("#password").val()==''){
						$.jBox.tip('请输入密码', 'error');
						return false;
					}
					if($("#rememberit").val()==1){
						cookie("username", $("#username").val());
					}
					$("#loginForm").submit();
				});
				
				$("#acheck").click(function(){
					if ($("#rememberit").val()==0){
						$("#acheck").removeClass("checkbox_d_uncheck");
						$("#acheck").addClass("checkbox_d");
						$("#rememberit").val('1');
						cookie("rememberit", 1);
					}
					else{
						$("#acheck").removeClass("checkbox_d");
						$("#acheck").addClass("checkbox_d_uncheck");
						$("#rememberit").val('0');
						cookie("rememberit", 0);
					}
				});
			});
		</script>
	</head>
<body>
<div class="login_box">
	<div class="loginbox_center clearfix">
    	<div class="login_leftbox"></div>
 		<div class="login_rightbox">
        	<h6>登录</h6>
            <div class="dl_box">
            <form id="loginForm" name="loginForm" method="post" action="${ctx }/dologin">
            	<input type="hidden" id="successUrl" name="successUrl" value="${successUrl }"/>
            	<div class="zh_box clearfix">
                	<label class="zh_name">帐号</label>
                    <div class="holderBox">
                		<input class="holderInput" id="username" name="username" type="text" value="${username}" onfocus="if(value=='请输入手机号') {value=''}" onblur="if (value=='') {value='请输入手机号'}"></input>
                    </div>
                </div>
                <div class="mima_box clearfix">
                	<label class="mm_name">密码</label>
                    <div class="holderBox">
                		<input class="holderInput" id="password" name="password" type="password" ></input>
                    </div>
                </div>
                <div class="jz_box clearfix">
                	<a id="acheck" class=" checkbox_d_uncheck" href="javascript:void(0);"></a>
                	<input type="hidden" id="rememberit" value="0"/>
                	<label class="checkbox_h">记住帐号</label>
                    <a class="checkbox_m" href="${ctx }/my/modpass"> 忘记密码？</a>
                </div>
                <div class="dl_btn"><button id="btnLogin" class="btn_red">立即登录</button></div>
                <div class="zc_clickbox"><a class="lj_clickbox" href="${ctx }/register">没有帐号？  免费注册</a></div>
            </form>
            </div>
        </div>	   
    </div>
</div>
</body>
</html>